<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div {
      width: 100px;
      height: 100px;
    }

    div:nth-child(1) {
      background-color: #f00;
      margin: 20px;
    }

    div:nth-child(2) {
      background-color: #fc0;
      margin: 50px;
    }

    span {
      font-size: 12px;
    }
  </style>
</head>

<body>
  <div class="box1"><span>wode</span></div>
  <div class="box2"></div>
  <script>
    var likeAry = {
      [Symbol.iterator]: function () {
        return {
          idx: 0,
          next() {
            if (this.idx < 5) {
              this.idx++;
              return {
                value: this.idx * 2,
                done: true
              }
            } else {
              return {
                value: undefined,
                done: false
              }
            }
          }
        }
      }
    }

    console.log(likeAry);

    console.log(...likeAry);

    for (var i of likeAry) {
      console.log(i);
    }

    // var keys = arr.keys();
    // var values = arr.values();

    // console.log(keys.next());
    // console.log(values.next());

    // for (var i in arr) {
    //   console.log(i);
    // }

    // for (var j of arr) {
    //   console.log(j);
    // }
  </script>
</body>

</html>